package com.rattsoftware.server.service;

import java.util.List;

import com.rattsoftware.server.admin.model.Room;
import com.rattsoftware.server.admin.model.exceptions.RattsSecurityException;
import com.rattsoftware.server.admin.model.paging.PagingLoadConfig;
import com.rattsoftware.server.admin.model.paging.PagingLoadResult;

public interface RoomService {

	/**
	 * Returns a given Room given the ID.
	 * 
	 * @param roomId
	 *            Id of the Room to retrieve.
	 * @return Room
	 */
	Room getRoomViaRoomId(int roomId) throws RattsSecurityException;
	
	/**
     * Gets a room based on its room number
     * @param roomNo Integer room number
     * @return Room, or null if no match found
     * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
     */
	Room getRoomViaRoomNo(int roomNo) throws RattsSecurityException;  
	
	/**
	 * Fetches all the system <tt>Rooms.</tt>
	 * 
	 * @return <tt>List</tt> of <tt>Rooms.</tt>
	 * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
	 */
	List<Room> getRooms() throws RattsSecurityException;
	
	/**
	 * Saves a dirty or new <tt>Room</tt>.
	 * 
	 * @param room <tt>Room</tt> to save.
	 * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
	 */
	void saveRoom(Room room) throws RattsSecurityException;
	
	/**
	 * Deletes a given <tt>Room</tt>.
	 * 
	 * @param room <tt>Room</tt> to delete.
	 * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
	 */
	void deleteRoom(Room room) throws RattsSecurityException;
	
	/**
	 * Persists a given list of rooms to the database.
	 * 
	 * @param rooms List of rooms to persist.
	 */
	void saveRooms(List<Room> rooms) throws RattsSecurityException;
	
	/**
	 * Retrieves a page of the Room data.
	 * 
	 * @param pagingLoadConfig
	 *            config to specify paging related config
	 * @return PagingLoadResult containing a page of Room data
	 */
	PagingLoadResult<Room> getRoomList( PagingLoadConfig pagingLoadConfig) throws RattsSecurityException;
}
